package controllers

import (
	"github.com/astaxie/beego"
	//"github.com/astaxie/beego/logs"
)

// ErrorController beego 框架默认支持 401、403、404、500、503 这几种错误的处理
type ErrorController struct {
	beego.Controller
}

func (c *ErrorController) Error404() {
	// c.Abort("401")// 重定向
	// c.Redirect("/", 302)// 中止此次请求并抛出异常
	c.Data["content"] = "page not found"
	c.TplName = "404.tpl"
}

func (c *ErrorController) Error501() {
	c.Data["content"] = "server error"
	c.TplName = "501.tpl"
}


func (c *ErrorController) ErrorDb() {
	c.Data["content"] = "database is now down"
	c.TplName = "dberror.tpl"
}